<template>
    <div>
              <el-row>
               
                 <el-col :span="24">
                    <el-input placeholder="请输入关键词搜索" style="width:20%" v-model="search">
                    <el-button  slot="append"  id="search" @click="searchbl">搜索</el-button >
                    </el-input>
                    <el-button style="float:right">导出数据</el-button>
                </el-col>
               
            </el-row>
            <el-row style="margin-top:10px">
                <el-table
                    ref="multipleTable"
                    :header-cell-style="{background:'#e5f1ff',color:'#606266'}"
                    :data="setupBlData"
                    tooltip-effect="dark"
                    style="width: 100%"
                    
                    >
            

                    <el-table-column
                    label="客户名称"
                     prop="c_nickname"
                    width="100" 
                    align="center">
                   
                    </el-table-column>

                    <el-table-column
                    prop="c_name"
                    label="真实姓名"
                   width="100" 
                     align="center">
                    </el-table-column>

                  
                     <el-table-column
                    prop="c_s_name"
                    label="操作客服"
                    width="100" 
                     align="center">
                    </el-table-column>
                     <el-table-column
                    prop="b_reson"
                    label="拉黑原因"
                    width="300" 
                     align="center">
                    </el-table-column>
                    
                      <el-table-column
                    prop="u_time"
                    label="拉黑时间"
                    width="200" 
                     align="center">
                    </el-table-column>
                     <el-table-column
                    prop="chaoz"
                    label="操作"
                    align="center">
                        <template slot-scope="scope">
                            <el-button type="text" size="small" @click="updateid(scope.$index)">详情</el-button>
                            <el-button type="text" size="small" @click="deleteid(scope.$index)">解禁</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div>
                     <el-dialog
                            title="拉黑详情"
                            :visible.sync="dialogupdatebl"
                            width="500px"
                                    align="left"
                                >
            
                                <p>客户名称：{{setupBlUpdate.c_nickname}}</p>
                            
                                <p >真实姓名：{{setupBlUpdate.c_name}}</p>
                                                       
                                <p >客户电话：{{setupBlUpdate.c_phone}}</p>
                             
                                <p >客户邮箱：{{setupBlUpdate.c_email}}</p>
                            
                                <p >操作客服：{{setupBlUpdate.c_s_name}}</p>
                             
                                <p >拉黑原因：{{setupBlUpdate.b_reson}}</p>
                        
                                <p >拉黑时间：{{setupBlUpdate.u_time}}</p>
                               
                        
                            <div slot="footer" class="dialog-footer">
                        
                            <el-button type="primary" @click="dialogupdatebl = false">确 定</el-button>
                            </div>
                        </el-dialog>



                         <el-dialog
                                    title="解禁确认"
                                    :visible.sync="dialogdeletebl"
                                    width="500px"
                                >
                                    <el-form>
                                    <el-form-item style="margin: 0px">
                                        <label> 确定要把此客户从黑名单接除吗？</label>
                                    </el-form-item>
                                    </el-form>
                                    <div slot="footer" class="dialog-footer">
                                    <el-button @click="dialogdeletebl = false">取 消</el-button>
                                    <el-button type="primary" @click="deleteblsj()">确 定</el-button
                                    >
                                    </div>
                                </el-dialog>
                </div>
            </el-row>
            <el-row style="margin-top:20px">
                    <div class="block">
                       <el-button style="float:right;margin-left:20px" size="small">确定</el-button>
                        <el-pagination style="float:right"
                        background
                        :page-sizes="[10, 20, 30, 40]"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="setupBlData.length">
                        </el-pagination>
                      
                       
                    </div>
            </el-row>
    </div>
</template>
<style scoped>
#search {
padding: 11px;
  background-color: #0170f3;
  border-radius: 0%;
  color: #ffffff;
 
} 
.el-button{
    padding: 12px 12px;
    border-radius: 0px;
}
</style>
<script>
import {mapState} from 'vuex'
export default {
    name:"BlackList",
    data(){
        return{
            setupkfdj:"",
            setupqbly:"",
            //状态
            status:"1",
            //搜索
            search:"",
            //解禁的id
            deleteblid:"",
            //拉黑详情弹框
            dialogupdatebl:false,
            //解禁弹框
            dialogdeletebl:false
        }
    },
    computed:{
        ...mapState("SetupModule",["setupBlData",'setupBlUpdate'])
    },
    mounted(){
        this.$store.dispatch('SetupModule/blall',{status:this.status})
    },
    methods:{
        //查看详情
        updateid(i){
            this.dialogupdatebl = true
           this.$store.commit('SetupModule/updatebl',i);
        },
        //解禁
        deleteid(i){
            this.dialogdeletebl = true
            this.deleteblid = i
        },
        deleteblsj(){
            this.$store.dispatch('SetupModule/bldelete',this.deleteblid)
              this.dialogdeletebl = false
        },
        //搜索
        searchbl(){
            if(this.search === ""){
                 this.$message({
                    showClose: true,
                    message: '请输入内容',
                    type: 'error'
                });
            }else{
               this.$store.dispatch("SetupModule/searchbl", this.search);
            }
        }
    },
    watch:{
        search:function() {
              if(this.search === ""){
                this.$store.dispatch('SetupModule/blall',{status:this.status})
            }
        }
    }
   
}
</script>